<template>
  <div>
    <button @click="connect">ok</button>
  </div>
</template>
<script>
import SockJS from "sockjs-client";
import Stomp from "stompjs";
export default {
  methods:{
    connect () {
      this.socket = new SockJS('http://localhost:8080/ws')
      this.stompClient = Stomp.over(this.socket)
      this.stompClient.connect({}, (frame) => {
        console.log(frame)
        this.stompClient.subscribe('/app/chat.addUser', (tick) => {
          console.log(tick)
        })
      }, (error) => {
        console.log(error)
      })
    },
  }
}
</script>